Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

148
Visualizações
Cannot GET /[object%20HTMLDivElement]

I have the following code but when I open the file through localhost, I get this message: Cannot GET /[object%20HTMLDivElement]. This is an application for getting location. Here is my HTML code:

<!DOCTYPE html>
    <html lang="en">
        <head >
           <style>
            h1{
                font-family:cursive;
                font-size:32pt;
            
            }
            body{
                display:flex;
                flex-direction:column;
            align-items:center;
            }
           </style>
            
        </head>
        <body>
            <h1>
                 GeoLocation Based on Speedometer and Compass
            </h1>
            <img src="compass.jpg">
            <input type="button" id="locationBtn" value="Get My Location" ">
            <div id="location">
               You will get Location here!! 
            </div>
            <script  src="geoLocation.js">
                
            </script>
        </body>
    </html>

here is my JS code (I have used it in separate js file):

var location=document.getElementById('location');
var button=document.getElementById('locationBtn');
button.addEventListener('click', function showLocation() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
    }else{
        alert('this browser does not support geolocation');
    }
});
function showPosition(position){
    location.innerHTML="Latitude: " + position.coords.latitude.toString() +
  "<br>Longitude: " + position.coords.longitude.toString();

}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda